﻿
namespace SPL.Windows.Forms
{
	/// <summary>
	/// This is the abstract edit form for the <see cref="Entities.DetailBatchGpp"/> entity.
	/// </summary>
	/// <remarks>This class is overwritten by .netTiers at each generation.</remarks>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class DetailBatchGppEditControlBase : System.Windows.Forms.UserControl
	{
		#region Fields
		
		//private System.Windows.Forms.TableLayoutPanel uxTableLayoutPanel;
		/// <summary>
		/// The ErrorProvider for the Entity;
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxErrorProvider;
		
		/// <summary>
		/// The BindingSource for the entity.
		///</summary>
		protected System.Windows.Forms.BindingSource uxBindingSource;
						
		
		/// <summary>
		/// TextBox for the Id property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxId;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Id property.
		/// </summary>
		protected System.Windows.Forms.Label uxIdLabel;
		
		/// <summary>
		/// ComboBox for the BatchId property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxBatchId;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the BatchId property.
		/// </summary>
		protected System.Windows.Forms.Label uxBatchIdLabel;
		
		/// <summary>
		/// TextBox for the Me1 property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxMe1;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Me1 property.
		/// </summary>
		protected System.Windows.Forms.Label uxMe1Label;
		
		/// <summary>
		/// TextBox for the Me2 property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxMe2;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Me2 property.
		/// </summary>
		protected System.Windows.Forms.Label uxMe2Label;
		
		/// <summary>
		/// CheckBox for the IsStop property.
		/// </summary>
		protected System.Windows.Forms.CheckBox uxIsStop;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IsStop property.
		/// </summary>
		protected System.Windows.Forms.Label uxIsStopLabel;
		
		/// <summary>
		/// DataTimePicker for the CreatedAt property.
		/// </summary>
		protected System.Windows.Forms.DateTimePicker uxCreatedAt;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the CreatedAt property.
		/// </summary>
		protected System.Windows.Forms.Label uxCreatedAtLabel;
		
		/// <summary>
		/// ComboBox for the CreatedBy property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxCreatedBy;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the CreatedBy property.
		/// </summary>
		protected System.Windows.Forms.Label uxCreatedByLabel;
		
		/// <summary>
		/// ComboBox for the Latest property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxLatest;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Latest property.
		/// </summary>
		protected System.Windows.Forms.Label uxLatestLabel;
		
		/// <summary>
		/// DataTimePicker for the InputTime property.
		/// </summary>
		protected System.Windows.Forms.DateTimePicker uxInputTime;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the InputTime property.
		/// </summary>
		protected System.Windows.Forms.Label uxInputTimeLabel;
		#endregion
		
		#region Main entity
		private Entities.DetailBatchGpp _DetailBatchGpp;
		/// <summary>
		/// Gets or sets the <see cref="Entities.DetailBatchGpp"/> entity to edit with this form.
		/// </summary>
		/// <value>The <see cref="Entities.DetailBatchGpp"/> instance.</value>
		public Entities.DetailBatchGpp DetailBatchGpp
		{
			get {return this._DetailBatchGpp;}
			set
			{
				this._DetailBatchGpp = value;
				if (value != null) 
				{
					this.uxBindingSource.DataSource = value;
					BindControls();
				}			
				
			}
		}
		#endregion
		
		/// <summary>
		/// Binds the controls.
		/// </summary>
		private void BindControls()
		{
			this.uxId.DataBindings.Clear();
			this.uxId.DataBindings.Add("Text", this.uxBindingSource, "Id", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxBatchId.DataBindings.Clear();
			this.uxBatchId.DataBindings.Add("SelectedValue", this.uxBindingSource, "BatchId", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxMe1.DataBindings.Clear();
			this.uxMe1.DataBindings.Add("Text", this.uxBindingSource, "Me1", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxMe2.DataBindings.Clear();
			this.uxMe2.DataBindings.Add("Text", this.uxBindingSource, "Me2", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIsStop.DataBindings.Clear();
			this.uxIsStop.DataBindings.Add("Checked", this.uxBindingSource, "IsStop", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxCreatedAt.DataBindings.Clear();
			this.uxCreatedAt.DataBindings.Add("Value", this.uxBindingSource, "CreatedAt", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxCreatedBy.DataBindings.Clear();
			this.uxCreatedBy.DataBindings.Add("SelectedValue", this.uxBindingSource, "CreatedBy", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxLatest.DataBindings.Clear();
			this.uxLatest.DataBindings.Add("SelectedValue", this.uxBindingSource, "Latest", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxInputTime.DataBindings.Clear();
			this.uxInputTime.DataBindings.Add("Value", this.uxBindingSource, "InputTime", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
		}					
		
		#region Constructor
		
		/// <summary>
		/// Initializes a new instance of the <see cref="DetailBatchGppEditControlBase"/> class.
		/// </summary>
		public DetailBatchGppEditControlBase()
		{
			InitializeComponent();			
			
			this.uxBindingSource.CurrentItemChanged += new System.EventHandler(uxBindingSource_currentItemChanged);
		}		
		
		/// <summary>
		/// 
		/// </summary>
		private void uxBindingSource_currentItemChanged(object sender, System.EventArgs e)
		{
			if (_DetailBatchGpp != null) _DetailBatchGpp.Validate();
		}	
				
		/// <summary>
		/// Initializes the component.
		/// </summary>
		public void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.uxErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxBindingSource = new System.Windows.Forms.BindingSource(this.components);
			
			//this.uxTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
			this.uxId = new System.Windows.Forms.TextBox();
			uxIdLabel = new System.Windows.Forms.Label();
			this.uxBatchId = new System.Windows.Forms.ComboBox();
			uxBatchIdLabel = new System.Windows.Forms.Label();
			this.uxMe1 = new System.Windows.Forms.TextBox();
			uxMe1Label = new System.Windows.Forms.Label();
			this.uxMe2 = new System.Windows.Forms.TextBox();
			uxMe2Label = new System.Windows.Forms.Label();
			this.uxIsStop = new System.Windows.Forms.CheckBox();
			uxIsStopLabel = new System.Windows.Forms.Label();
			this.uxCreatedAt = new System.Windows.Forms.DateTimePicker();
			uxCreatedAtLabel = new System.Windows.Forms.Label();
			this.uxCreatedBy = new System.Windows.Forms.ComboBox();
			uxCreatedByLabel = new System.Windows.Forms.Label();
			this.uxLatest = new System.Windows.Forms.ComboBox();
			uxLatestLabel = new System.Windows.Forms.Label();
			this.uxInputTime = new System.Windows.Forms.DateTimePicker();
			uxInputTimeLabel = new System.Windows.Forms.Label();
			
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).BeginInit();
			this.SuspendLayout();
			
			// 
			// uxTableLayoutPanel
			// 
			//this.uxTableLayoutPanel.AutoSize = true;
			//this.uxTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
			//this.uxTableLayoutPanel.ColumnCount = 2;
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F));
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 250F));
			//this.uxTableLayoutPanel.Location = new System.Drawing.System.Drawing.Point(3, 3);
			//this.uxTableLayoutPanel.Name = "uxTableLayoutPanel";
			//this.uxTableLayoutPanel.RowCount = 2;
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.Size = new System.Drawing.Size(450, 50);
			//this.uxTableLayoutPanel.TabIndex = 0;
			
			//
			// uxErrorProvider
			//
			this.uxErrorProvider.ContainerControl = this;
			this.uxErrorProvider.DataSource = this.uxBindingSource;
			
			//
			// uxIdLabel
			//
			this.uxIdLabel.Text = "Id:";
			this.uxIdLabel.Location = new System.Drawing.Point(3, 0);
			this.Controls.Add(this.uxIdLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIdLabel);			
			//
			// uxId
			//
			this.uxId.ReadOnly = true;
			//this.uxTableLayoutPanel.Controls.Add(this.uxId);
			this.uxId.Location = new System.Drawing.Point(160, 0);
			this.Controls.Add(this.uxId);
			//
			// uxBatchIdLabel
			//
			this.uxBatchIdLabel.Text = "BatchId:";
			this.uxBatchIdLabel.Location = new System.Drawing.Point(3, 26);
			this.Controls.Add(this.uxBatchIdLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxBatchIdLabel);			
			//
			// uxBatchId
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxBatchId);
			this.uxBatchId.Location = new System.Drawing.Point(160, 26);
			this.Controls.Add(this.uxBatchId);
			//
			// uxMe1Label
			//
			this.uxMe1Label.Text = "Me1:";
			this.uxMe1Label.Location = new System.Drawing.Point(3, 52);
			this.Controls.Add(this.uxMe1Label);
			//this.uxTableLayoutPanel.Controls.Add(this.uxMe1Label);			
			//
			// uxMe1
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxMe1);
			this.uxMe1.Location = new System.Drawing.Point(160, 52);
			this.Controls.Add(this.uxMe1);
			//
			// uxMe2Label
			//
			this.uxMe2Label.Text = "Me2:";
			this.uxMe2Label.Location = new System.Drawing.Point(3, 78);
			this.Controls.Add(this.uxMe2Label);
			//this.uxTableLayoutPanel.Controls.Add(this.uxMe2Label);			
			//
			// uxMe2
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxMe2);
			this.uxMe2.Location = new System.Drawing.Point(160, 78);
			this.Controls.Add(this.uxMe2);
			//
			// uxIsStopLabel
			//
			this.uxIsStopLabel.Text = "IsStop:";
			this.uxIsStopLabel.Location = new System.Drawing.Point(3, 104);
			this.Controls.Add(this.uxIsStopLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIsStopLabel);			
			//
			// uxIsStop
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxIsStop);
			this.uxIsStop.Location = new System.Drawing.Point(160, 104);
			this.Controls.Add(this.uxIsStop);
			//
			// uxCreatedAtLabel
			//
			this.uxCreatedAtLabel.Text = "CreatedAt:";
			this.uxCreatedAtLabel.Location = new System.Drawing.Point(3, 130);
			this.Controls.Add(this.uxCreatedAtLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxCreatedAtLabel);			
			//
			// uxCreatedAt
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxCreatedAt);
			this.uxCreatedAt.Location = new System.Drawing.Point(160, 130);
			this.Controls.Add(this.uxCreatedAt);
			//
			// uxCreatedByLabel
			//
			this.uxCreatedByLabel.Text = "CreatedBy:";
			this.uxCreatedByLabel.Location = new System.Drawing.Point(3, 156);
			this.Controls.Add(this.uxCreatedByLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxCreatedByLabel);			
			//
			// uxCreatedBy
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxCreatedBy);
			this.uxCreatedBy.Location = new System.Drawing.Point(160, 156);
			this.Controls.Add(this.uxCreatedBy);
			//
			// uxLatestLabel
			//
			this.uxLatestLabel.Text = "Latest:";
			this.uxLatestLabel.Location = new System.Drawing.Point(3, 182);
			this.Controls.Add(this.uxLatestLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxLatestLabel);			
			//
			// uxLatest
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxLatest);
			this.uxLatest.Location = new System.Drawing.Point(160, 182);
			this.Controls.Add(this.uxLatest);
			//
			// uxInputTimeLabel
			//
			this.uxInputTimeLabel.Text = "InputTime:";
			this.uxInputTimeLabel.Location = new System.Drawing.Point(3, 208);
			this.Controls.Add(this.uxInputTimeLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxInputTimeLabel);			
			//
			// uxInputTime
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxInputTime);
			this.uxInputTime.Location = new System.Drawing.Point(160, 208);
			this.Controls.Add(this.uxInputTime);
			//
			// uxBatchId
			//				
			this.uxBatchId.DisplayMember = "BatchNo";	
			this.uxBatchId.ValueMember = "Id";	
			//
			// uxLatest
			//				
			this.uxLatest.DisplayMember = "BatchId";	
			this.uxLatest.ValueMember = "Id";	
			//
			// uxCreatedBy
			//				
			this.uxCreatedBy.DisplayMember = "Username";	
			this.uxCreatedBy.ValueMember = "Id";	
			// 
			// DetailBatchGppEditControlBase
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			//this.Controls.Add(this.uxTableLayoutPanel);
			this.AutoScroll = true;
			this.Name = "DetailBatchGppEditControlBase";
			this.Size = new System.Drawing.Size(478, 311);
			//this.Localizable = true;
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).EndInit();			
			this.ResumeLayout(false);
			this.PerformLayout();
		}
		#endregion
				
		#region ComboBox List
		
				
		private Entities.TList<Entities.Batch> _BatchIdList;
		
		/// <summary>
		/// The ComboBox associated with the BatchId property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.Batch> BatchIdList
		{
			get {return _BatchIdList;}
			set 
			{
				this._BatchIdList = value;
				this.uxBatchId.DataSource = null;
				this.uxBatchId.DataSource = value;
			}
		}
		
		private bool _allowNewItemInBatchIdList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the BatchId property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInBatchIdList
		{
			get { return _allowNewItemInBatchIdList;}
			set
			{
				this._allowNewItemInBatchIdList = value;
				this.uxBatchId.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
				
		private Entities.TList<Entities.DetailBatchGpp> _LatestList;
		
		/// <summary>
		/// The ComboBox associated with the Latest property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.DetailBatchGpp> LatestList
		{
			get {return _LatestList;}
			set 
			{
				this._LatestList = value;
				this.uxLatest.DataSource = null;
				this.uxLatest.DataSource = value;
			}
		}
		
		private bool _allowNewItemInLatestList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the Latest property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInLatestList
		{
			get { return _allowNewItemInLatestList;}
			set
			{
				this._allowNewItemInLatestList = value;
				this.uxLatest.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
				
		private Entities.TList<Entities.User> _CreatedByList;
		
		/// <summary>
		/// The ComboBox associated with the CreatedBy property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.User> CreatedByList
		{
			get {return _CreatedByList;}
			set 
			{
				this._CreatedByList = value;
				this.uxCreatedBy.DataSource = null;
				this.uxCreatedBy.DataSource = value;
			}
		}
		
		private bool _allowNewItemInCreatedByList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the CreatedBy property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInCreatedByList
		{
			get { return _allowNewItemInCreatedByList;}
			set
			{
				this._allowNewItemInCreatedByList = value;
				this.uxCreatedBy.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	}
}
